<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                xmlns:h="http://java.sun.com/jsf/html" xmlns:util="http://xmlns.jcp.org/jsf/composite/util"
                xmlns:f="http://java.sun.com/jsf/core">

    <h:form id="system_tags_form">

        <util:dataTableWrapper title="Lista etichete de sistem">
            <f:facet name="buttonContent">
                <p:commandButton icon="custom-icon-add" value="Adauga eticheta noua"
                                 oncomplete="PF('add_system_tag_WV').show()" update=":create_system_tag_form"
                                 resetValues="true"
                                 actionListener="#{systemTagAdministrationBean.resetCreateSystemTagDialog}"/>
            </f:facet>

            <f:facet name="rightContent">
                <p:outputPanel layout="block">
                    <p:watermark for="search-input" value="cauta eticheta de sistem dupa: nume)"/>
                    <p:inputText id="search-input" style="width: 240px;margin-right: 5px"/>
                    <p:commandButton value="Cauta"/>
                </p:outputPanel>
            </f:facet>

            <p:dataTable id="system_tags_table" var="s" value="#{systemTagAdministrationBean.systemTags}"
                         emptyMessage="Nu a fost gasita nici o inregistrare."
                         paginator="true" paginatorPosition="bottom" rowsPerPageTemplate="5,10,15" rows="10"
                         paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}">

                <p:column headerText="Nume" width="15%" sortBy="#{s.name}">
                    <h:outputText value="#{s.name}"/>
                </p:column>

                <p:column headerText="Descriere" width="40%">
                    <h:outputText value="#{s.description}"/>
                </p:column>

                <p:column headerText="Valoare" width="25%">
                    <h:outputText value="#{s.value}"/>
                </p:column>

                <p:column headerText="Actions" width="20%" styleClass="override-icons">
                    <p:commandButton icon="custom-icon-edit" value="Editeaza"
                                     actionListener="#{systemTagAdministrationBean.setSelectedSystemTag(s)}"
                                     oncomplete="PF('add_system_tag_WV').show()" update=":create_system_tag_form"/>

                    <p:commandButton icon="custom-icon-delete" value="Sterge"
                                     actionListener="#{systemTagAdministrationBean.deleteSystemTag(s)}"
                                     update="@form" rendered="#{systemTagAdministrationBean.noSystemTagType(s)}">
                        <p:confirm header="Confirma"
                                   message="Sunteti sigur ca doriti stergerea etichetei de sistem?"
                                   icon="ui-icon-alert"/>
                    </p:commandButton>
                </p:column>
            </p:dataTable>
        </util:dataTableWrapper>
        <p:confirmDialog global="true">
            <p:commandButton value="Da" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check"/>
            <p:commandButton value="Nu" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close"/>
        </p:confirmDialog>
    </h:form>

</ui:composition>